#execute_process(COMMAND "git" "describe" "--always" "--dirty" "--tags"
#                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
#                RESULT_VARIABLE GIT_DESCRIBE_RESULT
#                OUTPUT_VARIABLE GIT_DESCRIBE_STRING)
#execute_process(COMMAND "git" "rev-parse" "--short" "HEAD"
#                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
#                RESULT_VARIABLE GIT_DESCRIBE_RESULT
#                OUTPUT_VARIABLE GIT_DESCRIBE_STRING)
#string(STRIP ${GIT_DESCRIBE_STRING} GIT_DESCRIBE_STRING)
#message("Git describe result: ${GIT_DESCRIBE_RESULT}")
#message("Git commit id: ${GIT_DESCRIBE_STRING}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/xm_version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/xm_version.h)

set(RTP_SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtcp/transport_feedback.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_exten.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_factory.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_factory.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_fec.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_fec.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_header.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_header.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_map.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_map.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_packet.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_packet.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_red.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_red.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_rtx.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp/rtp_rtx.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/h264/h264_nal.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/h264/h264_nal.hpp
        PARENT_SCOPE)

set(NMEDIA_SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NCircularBuffer.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NCircularBuffer.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NLogger.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NLogger.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTCPPacket.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTCPPacket.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPIncomingSource.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPIncomingSource.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPMap.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPMap.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPPacketWindow.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPPacketWindow.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPReceiver.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPReceiver.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPTime.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NRTPTime.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NUtil.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/NMedia/NUtil.hpp
        PARENT_SCOPE)

set(TEST_SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/aimd_rate_control_test.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/inter_arrival_test.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/packet_hist_test.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/overuse_detector_test.hpp
        )

set(RTC_XSWITCH_SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/aimd_rate_control.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/bitrate.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/bwe.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/estimator.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/inter_arrival.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/overuse_detector.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/overuse_estimator.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/bwe/packet_hist.hpp

#        ${CMAKE_CURRENT_SOURCE_DIR}/bitrate_estimator.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/batch_sender.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/batch_sender.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/push_to_talk.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/push_to_talk.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/codecs.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/codecs.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/http_parser.c
        ${CMAKE_CURRENT_SOURCE_DIR}/http_parser.c
        ${CMAKE_CURRENT_SOURCE_DIR}/http_parser.h
        ${CMAKE_CURRENT_SOURCE_DIR}/mixer_manager.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/mixer_manager.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/nack_handler.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/nack_handler.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp_history.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/placeholder.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/placeholder.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/proxy.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/proxy.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_address_list.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_address_list.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_connector.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_connector.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_mixer.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/remote_mixer.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp.hpp
#        ${CMAKE_CURRENT_SOURCE_DIR}/packet_history.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtc_manager.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtc_manager.h
        ${CMAKE_CURRENT_SOURCE_DIR}/rtc_recorder.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtc_recorder.h
        ${CMAKE_CURRENT_SOURCE_DIR}/rtcp_handler.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtcp_handler.h
        ${CMAKE_CURRENT_SOURCE_DIR}/rtcp_utility.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/rtcp_utility.h
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp_rtcp_config.h
        ${CMAKE_CURRENT_SOURCE_DIR}/rtp_rtcp_defines.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xcutil.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xcutil.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xdtls_srtp.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xdtls_srtp.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xhttp_str.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xhttp_str.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_app_config.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_app_config.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_cache.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_cache.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_crash.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_crash.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_log.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_log.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xm_version.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xmixer.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xmixer.h
        #${CMAKE_CURRENT_SOURCE_DIR}/mixer2.cpp
        #${CMAKE_CURRENT_SOURCE_DIR}/mixer2.hpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xplugin_rtc_debug.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xplugin_rtc_debug.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtc_endpoint.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtc_endpoint.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtc_endpoint_connector.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtc_endpoint_connector.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtcp_util.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtcp_util.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtp_depack.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xrtp_depack.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xsdp.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xsdp.h
        ${CMAKE_CURRENT_SOURCE_DIR}/xtlv_file.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/xtlv_file.h
        ${CMAKE_CURRENT_SOURCE_DIR}/ulpfec_decoder.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/ulpfec_decoder.hpp
        PARENT_SCOPE)

